﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;

namespace ExameRegister.Ctrls
{
    public class ImageButton : Button
    {
        public ImageButton()
            : base()
        {
            this.DefaultStyleKey = typeof(ImageButton);
        }

        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();

            object tobj = App.Current.Resources["TIcon"];

            if (tobj != null && tobj is List<ImageSource>)
                this.NormalImage = ((List<ImageSource>)tobj)[ImageIndex];
            

        }

        public static readonly DependencyProperty normalImageProperty = DependencyProperty.Register("NormalImage", typeof(ImageSource), typeof(ImageButton), null);
        public ImageSource NormalImage
        {
            get { return (ImageSource)GetValue(normalImageProperty); }
            set { SetValue(normalImageProperty, value); }
        }



        public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("IBTitle", typeof(string), typeof(ImageButton), null);
        public string IBTitle
        {
            get { return GetValue(TitleProperty).ToString(); }
            set { SetValue(TitleProperty, value); }
        }

        public static readonly DependencyProperty ImageIndexProperty = DependencyProperty.Register("ImageIndex", typeof(int), typeof(ImageButton), null);
        public int ImageIndex
        {
            get { return Convert.ToInt32(GetValue(ImageIndexProperty)); }
            set { SetValue(ImageIndexProperty, value); }
        }
    }
}
